@isTest
private class UpdateSalesYszxdetailsBatchTest {

        static testMethod void testMethod1(){
            
            UpdateSalesYszxdetailsBatch batch = new UpdateSalesYszxdetailsBatch();
                  //创建客户
               
                Account a = TestUtils.createAccount();
                a.NCICCode__c = '00001';
                insert a ; 
            //创建实业借货明细
                SalesYszxdetails__c s = new SalesYszxdetails__c();
                s.pk_cubasdoc__c = '00001';
                
                s.pk_invbasdoc__c = '00001';
                s.RelateAccount__c = a.Id;
                
                insert s ;
                
                

                
                //创建产品
                Product__c p = TestUtils.createProduct();
                p.pk_invbasdoc__c = '00001';
                
                insert p ;
                

          Test.startTest();
         String fmt = '0 10 0 1-31 1-12 ? 2017-2098';//每天执行一次
         String jobId = System.schedule('testBasicScheduledApex',fmt,
                new UpdateSalesYszxdetails());
         CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered,NextFireTime
                            FROM CronTrigger WHERE id = :jobId];
            
         System.assertEquals(fmt,ct.CronExpression);
            Test.stopTest();
                System.assertEquals(s.pk_invbasdoc__c,p.pk_invbasdoc__c);
                System.assertEquals(s.pk_cubasdoc__c,a.NCICCode__c);

                
            
        }
}